package com.sds.shop.action;

import java.io.IOException;
import java.util.Vector;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.sds.fw.mvc.Action;
import com.sds.fw.mvc.HttpUtil;
import com.sds.shop.dao.MemDAO;
import com.sds.shop.vo.MemVO;
import com.sds.shop.vo.SessionVO;


public class Admin extends Action {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
		
						MemDAO dao = MemDAO.getInstance();

						HttpSession session = request.getSession();
						SessionVO svo = (SessionVO)session.getAttribute("user");
						
					//	String mem_cd = (String)request.getParameter("mem_cd");
						
						if(svo.getMemCd().toLowerCase().equals("adm")){
							
							MemVO vo = new MemVO();
							
							vo.setMemId(svo.getMemId());
							vo.setMemCd(svo.getMemCd());
							
							Vector<MemVO> list = (Vector<MemVO>)dao.list(vo);
							
							System.out.println("success");
							
							HttpUtil.redirect(response, "adminview.do");
							
							
						}else{
							
							System.out.println("failed");
							
						}
						
	}

}
